package com.chinasoft.goodsManager.servlet;

import com.chinasoft.goodsManager.service.OrderService;
import com.chinasoft.goodsManager.service.impl.OrderServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/orderDel")
public class OrderDelServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html");
        response.setHeader("Content-Type", "application/json;charset=UTF-8");
        OrderService service = new OrderServiceImpl();
        String oid = request.getParameter("oid");
        boolean del = service.del(oid);
        if(del){
            response.getWriter().write("1");
        }else
            response.getWriter().write("0");
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }
}
